<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>无重复字符串的排列组合</title>
</head>

<body>
  <script>
    var permutation = function (S) {
      const len = S.length
      const res = []
      const dps = (str) => {
        if (str.length === len) return res.push(str.join(''))
        for (let i = 0; i < len; i++) {
          if (str.includes(S[i])) continue
          str.push(S[i])
          dps(str)
          str.pop()
        }
      }
      dps([])
      return res
    };
    console.log(permutation("qwe"));
  </script>
</body>

</html>